{include file=$header_start}
{strip}
<link rel="stylesheet" type="text/css" href="{$siteroot}/templates/default/style/registration.css">
<script type="text/javascript" src="{$siteroot}/includes/js/register.js"></script>
<script src="{$siteroot}/includes/js/admin/ajax.js" type="text/javascript" ></script>
{/strip}
{literal}
<script type="text/javascript">

function validateFrm()
{
	
		var isvalid = false;
		var method = $("input[type='radio'][name='paymentmethod']:checked").val();
		if(method=='nab')
		{
		
				var year = document.getElementById('carddate').value;
				var mon = document.getElementById('cardmonth').value;
				
				// TODAYS DATE
				var today = new Date();
				var todayDate,todayMonth,todayYear;
				todayDate=parseInt(today.getDate());
				todayMonth=parseInt(today.getMonth());
				todayYear=parseInt(today.getFullYear());
				
				var expYears;
				var expMon;
				expYears = parseInt(year);
				expMon = parseInt(mon);
				
				/************ Check valid Security code ************/
				var cc_code = document.getElementById("cardcode").value;			
				var cc_code_lengh = cc_code.length;
				var cc_type = document.getElementById("cardtype").value;
				var cc_number = document.getElementById("cardnumber").value;
				if(cc_type=='')
				{
					document.getElementById('cardtype_msg').innerHTML = "Please select a type of card.";
					return false;	
				}
				if(cc_number=='' || cc_number.length!=16)
				{
					document.getElementById('cardnumber_msg').innerHTML = "Please enter card number.";
					return false;	
				}
		
				if((todayYear == expYears) && (expMon < todayMonth))
				{
					isvalid = false;
					document.getElementById('date_error').innerHTML = "Please Select Proper Expiration Date.";
					document.getElementById('cardmonth').focus();
					return false;
				}		
				else if(cc_type == "Visa" || cc_type == "MasterCard")
				{	
					if(cc_code_lengh != "3")
					{
						document.getElementById("scode_msg").innerHTML = "Please enter valid security code";
						return false;
					}
					else
					{
						isvalid = true;
						document.getElementById('date_error').innerHTML = "";
						document.getElementById("scode_msg").innerHTML = "";
						if(isvalid == true)
						{
								return true;
						}
						return true;
					}
				}
				else if(cc_type == "AmEx")
				{
					if(cc_code_lengh != "4")
					{
						document.getElementById("scode_msg").innerHTML = "Please enter valid security code";
						return false;
					}
					else
					{
						isvalid = true;
						document.getElementById('date_error').innerHTML = "";
						document.getElementById("scode_msg").innerHTML = "";
						if(isvalid == true)
						{
							return true;								
						}
					}
				}
				/************ End of Check valid Security code ************/
				
		}
		else
			return true;
	
}


function showCity(sid){
	ajax.sendrequest("GET",SITEROOT + "/admin/city/show_city.php",{sid:sid},"","isShowCity");
}
function paymentfunction(i,planid)
{

	if(i==1)
	{
		document.getElementById("paymentdiv").style.display="none";
		document.getElementById("paymentdiv_value").value='0';		
		document.getElementById("paymentdiv_btn").style.display="block";		
	}
	if(i!=1)
	{
		document.getElementById("paymentdiv").style.display="block";
		document.getElementById("paymentdiv_value").value='1';		
		document.getElementById("paymentdiv_btn").style.display="none";		
	}	
	document.getElementById("plan_id").value=planid;		
}
jQuery(document).ready(function(){
		jQuery("#btn_back").click(function(){
			window.location.href=SITEROOT +'/register/step3/'
		});		
		jQuery("#new_btnstep4").click(function(){
			if(validateFrm())
				jQuery("#frmTradesmanAdd").submit();
		});		
		
	});
</script>
{/literal}



{include file=$header_end}


<!-- MIDDLE CONTAIN GOES HERE -->
<section class="inner_wrapper">
<section class="middle_portion">
	<h1 class="registr_head">registration</h1>
    <section class="regis_steps_breadcrum_wrapper">
        <section class="lF"><img src="{$siteroot}/templates/default/images/register_steps/registr_step1.png"></section>
        <section class="lF"><img src="{$siteroot}/templates/default/images/register_steps/registr_step2.png"></section>
        <section class="lF"><img src="{$siteroot}/templates/default/images/register_steps/registr_step3.png"></section>
        <section class="lF"><img src="{$siteroot}/templates/default/images/register_steps/registr_step4_ho.png"></section>
        <section class="lF"><img src="{$siteroot}/templates/default/images/register_steps/registr_step5.png"></section>
        <section class="clear"></section>
    </section>   
     
   <form id="frmTradesmanAdd" name="frmTradesmanAdd" method="POST" action="{$siteroot}/register/gotopayment/"> 
   
   <section class="regist_form">
    <h1 style="margin:20px 0;border-bottom:1px solid #B3B3B3; ">Order detail</h1>
	<div class="itemslist" style="margin-top:20px;">
    <table cellpadding="0" cellspacing="0" width="100%" class="table_viewbox">
                <thead>
                    <tr>
                        <th>Item Name</th>
                        <th width="100" style="text-align:right;">Price</th>
                    </tr>
                </thead>
                <tbody>
	                <tr>
                        <td colspan="2" class="registr_head_td">Membership Plan</td>
                     </tr>
                     <tr>
                        <td>{$plan.name}</td>
                        <td style="text-align:right;">${$plan.price}</td>
                     </tr>
                     
                	<tr>
                        <td colspan="2" class="registr_head_td">Categories costing</td>
                     </tr>
                
                	{section name=i loop=$cats}
                	{section name=j loop=$cats[i].data}
                    <tr>
                        <td>{$cats[i].data[j].trade_category}</td>
                        <td style="text-align:right;">${$cats[i].data[j].price}</td>
                     </tr>
	                {/section}
                    {/section}
                      	
              	 <tr>
                    <td style="text-align:right; padding-right:20px"><strong>Sub total</strong></td>
                    <td style="text-align:right">$<span id="total_price"><strong>{$subtotal}</strong></span></td>                    
                </tr>
              	 <tr>
                    <td style="text-align:right; padding-right:20px"><strong>Tax GST({$tax}%)</strong></td>
                    <td style="text-align:right">$<span id="total_price"><strong>{$subtax}</strong></span></td>                    
                </tr>
              	 <tr>
                    <td style="text-align:right; padding-right:20px"><strong>Total</strong></td>
                    <td style="text-align:right">$<span id="total_price"><strong>{$total}</strong></span></td>                    
                </tr>
             </tbody>
         </table> 
   </div>
   </section>
   
   <section class="regist_form">
     <h1 style="margin:20px 0;border-bottom:1px solid #B3B3B3; ">Payment Method</h1>
     
     <div class="payment">
         {if $paypal.published eq 1}
         	<div class="paypal paymentitem">
            	<input type="radio" name="paymentmethod" value="paypal"  checked="checked" /> <strong>Paypal</strong>
                <p align="center">
                <img src="../../images/paypal.jpg">
                </p>
                
            </div>
		{/if}
        {if $nab.published eq 1}
         	<div class="nab paymentitem">
            	<input type="radio" name="paymentmethod" value="nab"  /> <strong>NAB</strong><br />
                <div class="nablogo" style="margin-top:10px;">
            	<p align="center">
                	<img src="../../images/visa_mastercard_logo.gif" height="65" />
                	<img src="../../images/nab.jpg"  height="65"/>
                </p>
                </div>
                
                
                <dl>
                <dt>Card Type</dt>
                <dd>
                    <select class="input3" id="cardtype" name="cardtype">
                        <option value="">Select Card Type</option>
                        <option value="Visa" {if $detail.cardtype eq 'Visa'} selected="selected" {/if}>VISA </option>
                        <option value="MasterCard" {if $detail.cardtype eq 'MasterCard'} selected="selected" {/if}>Master Card </option>
                        <option value="AmEx" {if $detail.cardtype eq 'AmEx'} selected="selected" {/if}>American Express </option>
                        
                    </select>
                </dd>
                <section class="clear"></section>
                <div style="color:#F00;" id="cardtype_msg"></div>
            </dl>
              
              
                
        <dl>
        	<dt>Card Number</dt>
            <dd><input type="text" class="input" name="cardnumber" id="cardnumber" maxlength="16" value="{$detail.cardnumber}" /></dd>
            <section class="clear"></section>
            <div style="color:#F00;" id="cardnumber_msg"></div>
        </dl>
 
       	<dl class="space10">
        	<dt>Security Code</dt>
            <dd><input type="text" class="input10" name="cardcode" id="cardcode"  maxlength="4"  value="{$detail.cardcode}" /></dd>            
            <section class="clear"></section>
            
            <div style="color:#F00;" id="scode_msg"></div>
        </dl>
        <dl class="space40">
        	<dt>Expiration Date</dt>
            <dd>
             <section class="select_box_container">
                <select class="select Rmargin15" name="cardmonth" id="cardmonth">
                	<option value="">Select Month</option>
                    {section name=k start=1 loop=13 step=1}
		                <option value="{$smarty.section.k.index|str_pad:2:"0":$smarty.const.STR_PAD_LEFT}" {if $detail.cardmonth == $smarty.section.k.index|str_pad:2:"0":$smarty.const.STR_PAD_LEFT} selected="selected" {/if}>{$smarty.section.k.index|str_pad:2:"0":$smarty.const.STR_PAD_LEFT}</option>
                    {/section}
                </select>
            </section>
             <section class="select_box_container">    
                <select class="select Rmargin15" name="carddate" id="carddate">
                	<option value="">Select Year</option>
                    {section name=yr loop=$yr_arr}
	                    <option value="{$yr_arr[yr]}" {if $detail.carddate == $yr_arr[yr]} selected="selected" {/if}>{$yr_arr[yr]}</option>
                    {/section}
                </select>
             </section>   
            </dd>
            <div id="date_error" style="color:#F00;"></div> 
            <section class="clear"></section>
        </dl>
    
        <dl>
        	<dt>Cardholder Name</dt>
            <dd><input type="text" class="input" name="card_holder" id="card_holder" value="{$detail.card_holder}" maxlength="20" /></dd>
            <section class="clear"></section>
        </dl>
   
            </div>
         {/if}
         </div>
     
   </section>
   <section class="clear"></section>
   <h1 style="border-bottom:1px solid #B3B3B3; ">&nbsp;</h1>
    <div style="">
 		 <table cellpadding="0" cellspacing="0" width="100%" border="0" height="40" >
          		<tr>
                	<td align="left" width="50%"></td>
                    <td align="right"><input type="button" class="blue_btn rF" value="Back"  name="back" id="btn_back" /></td>
                    <td align="right" width="70"> <input type="button" name="new_btnstep4" id="new_btnstep4" value="Next" class="blue_btn margintp_bt rF" ></td>
                </tr>
          </table>
		  <section class="clear"></section>
 	</div>
    <section class="clear"></section>
    </form>
    
</section>
</section>
{include file=$footer}